// components/common/footer/index.js
Component({
    behaviors: [],

    properties: {
        active: {
            type: String,
            value: 'home'
        },
        admin: {
            type: Boolean,
            value: false
        }
    },

    data: {
        tabbar: [
            { icon: 'wap-home-o', label: '首页', name: 'home', page: '/pages/index/index' },
            { icon: 'upgrade', label: '上传图片', name: 'up', page: '/pages/admin/create/create' }
        ]
    },

    lifetimes: {
        /* 生命周期函数 */
    },
    
    pageLifetimes: {
        /* 组件所在页面的生命周期函数 */
    },

    methods: {
        onTabbarChange: function (event) {
            let url;
            this.data.tabbar.forEach(function(item){
                if(item.name == event.detail){
                    url = item.page
                }
            })
            wx.redirectTo({
              url: url,
            })
        }
    }
});